(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[72,77],{105:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"c",(function(){return n})),r.d(t,"b",(function(){return o}));const s=window.CustomEvent||null,c=(e,{bubbles:t=!1,cancelable:r=!1,element:c,detail:n={}})=>{if(!s)return;c||(c=document.body);const o=new s(e,{bubbles:t,cancelable:r,detail:n});c.dispatchEvent(o)},n=({preserveCartData:e=!1})=>{c("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:e}})},o=(e,t,r=!1,s=!1)=>{if("function"!=typeof jQuery)return()=>{};const n=()=>{c(t,{bubbles:r,cancelable:s})};return jQuery(document).on(e,n),()=>jQuery(document).off(e,n)}},112:function(e,t,r){"use strict";var s=r(0),c=r(57),n=r(4),o=r.n(n),a=r(79);r(133),t.a=({className:e,showSpinner:t=!1,children:r,variant:n="contained",...i})=>{const u=o()("wc-block-components-button","wp-element-button",e,n,{"wc-block-components-button--loading":t});return Object(s.createElement)(c.a,{className:u,...i},t&&Object(s.createElement)(a.a,null),Object(s.createElement)("span",{className:"wc-block-components-button__text"},r))}},114:function(e,t){},120:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));const s=e=>"number"==typeof e},121:function(e,t,r){"use strict";r.d(t,"b",(function(){return s}));const s=()=>window.performance&&window.performance.getEntriesByType("navigation").length?window.performance.getEntriesByType("navigation")[0].type:"";t.a=s},133:function(e,t){},150:function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return i})),r.d(t,"c",(function(){return u}));var s=r(84),c=(r(15),r(2)),n=r(23),o=r(30);const a=e=>{const t=Object.keys(c.defaultAddressFields),r=Object(s.a)(t,{},e.country),n=Object.assign({},e);return r.forEach((({key:t="",hidden:r=!1})=>{r&&((e,t)=>e in t)(t,e)&&(n[t]="")})),n},i=e=>{if(0===Object.values(e).length)return null;const t="string"==typeof o.i[e.country]?Object(n.decodeEntities)(o.i[e.country]):"",r="object"==typeof o.j[e.country]&&"string"==typeof o.j[e.country][e.state]?Object(n.decodeEntities)(o.j[e.country][e.state]):e.state,s=[];s.push(e.postcode.toUpperCase()),s.push(e.city),s.push(r),s.push(t);return s.filter(Boolean).join(", ")||null},u=e=>!!e.city&&!!e.country},154:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var s=r(70);const c=(e,t)=>(r,c=10)=>{const n=s.a.addEventCallback(e,r,c);return t(n),()=>{t(s.a.removeEventCallback(e,n.id))}}},163:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return a}));var s=r(37),c=r(20);const n=e=>Object(c.a)(e)&&Object(c.b)(e,"type"),o=async(e,t,r)=>{const c=Object(s.a)(e,t),n=[];for(const e of c)try{const t=await Promise.resolve(e.callback(r));"object"==typeof t&&n.push(t)}catch(e){console.error(e)}return!n.length||n},a=async(e,t,r)=>{const c=[],o=Object(s.a)(e,t);for(const e of o)try{const t=await Promise.resolve(e.callback(r));if(!n(t))continue;if(!t.hasOwnProperty("type"))throw new Error("Returned objects from event emitter observers must return an object with a type property");if(Object(s.b)(t)||Object(s.c)(t))return c.push(t),c;c.push(t)}catch(e){return console.error(e),c.push({type:s.e.ERROR}),c}return c}},20:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return n}));var s=r(38);const c=e=>!Object(s.a)(e)&&e instanceof Object&&e.constructor===Object;function n(e,t){return c(e)&&t in e}},29:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));const s=e=>"string"==typeof e},37:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"e",(function(){return n})),r.d(t,"d",(function(){return o})),r.d(t,"b",(function(){return i})),r.d(t,"c",(function(){return u}));var s=r(20);const c=(e,t)=>e[t]?Array.from(e[t].values()).sort(((e,t)=>e.priority-t.priority)):[];let n=function(e){return e.SUCCESS="success",e.FAIL="failure",e.ERROR="error",e}({}),o=function(e){return e.CART="wc/cart",e.CHECKOUT="wc/checkout",e.PAYMENTS="wc/checkout/payments",e.EXPRESS_PAYMENTS="wc/checkout/express-payments",e.CONTACT_INFORMATION="wc/checkout/contact-information",e.SHIPPING_ADDRESS="wc/checkout/shipping-address",e.BILLING_ADDRESS="wc/checkout/billing-address",e.SHIPPING_METHODS="wc/checkout/shipping-methods",e.CHECKOUT_ACTIONS="wc/checkout/checkout-actions",e}({});const a=(e,t)=>Object(s.a)(e)&&"type"in e&&e.type===t,i=e=>a(e,n.ERROR),u=e=>a(e,n.FAIL)},38:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));const s=e=>null===e},400:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var s=r(0),c=r(5),n=r(3),o=r(23),a=r(72);const i=(e,t)=>{const r=e.find((({id:e})=>e===t));return r?r.quantity:0},u=e=>{const{addItemToCart:t}=Object(c.useDispatch)(n.CART_STORE_KEY),{cartItems:r,cartIsLoading:u}=Object(a.a)(),{createErrorNotice:l,removeNotice:d}=Object(c.useDispatch)("core/notices"),[b,p]=Object(s.useState)(!1),E=Object(s.useRef)(i(r,e));return Object(s.useEffect)((()=>{const t=i(r,e);t!==E.current&&(E.current=t)}),[r,e]),{cartQuantity:Number.isFinite(E.current)?E.current:0,addingToCart:b,cartIsLoading:u,addToCart:(r=1)=>(p(!0),t(e,r).then((()=>{d("add-to-cart")})).catch((e=>{l(Object(o.decodeEntities)(e.message),{id:"add-to-cart",context:"wc/all-products",isDismissible:!0})})).finally((()=>{p(!1)})))}}},431:function(e,t){},432:function(e,t){},497:function(e,t,r){"use strict";r.r(t);var s=r(145),c=r(0),n=r(4),o=r.n(n),a=r(1),i=r(27);const u=e=>e.is_purchasable||!1;var l=r(5),d=r(3);const b={PRISTINE:"pristine",IDLE:"idle",DISABLED:"disabled",PROCESSING:"processing",BEFORE_PROCESSING:"before_processing",AFTER_PROCESSING:"after_processing"},p={status:b.PRISTINE,hasError:!1,quantity:0,processingResponse:null,requestParams:{}},E={SET_PRISTINE:"set_pristine",SET_IDLE:"set_idle",SET_DISABLED:"set_disabled",SET_PROCESSING:"set_processing",SET_BEFORE_PROCESSING:"set_before_processing",SET_AFTER_PROCESSING:"set_after_processing",SET_PROCESSING_RESPONSE:"set_processing_response",SET_HAS_ERROR:"set_has_error",SET_NO_ERROR:"set_no_error",SET_QUANTITY:"set_quantity",SET_REQUEST_PARAMS:"set_request_params"},{SET_PRISTINE:m,SET_IDLE:_,SET_DISABLED:O,SET_PROCESSING:h,SET_BEFORE_PROCESSING:f,SET_AFTER_PROCESSING:S,SET_PROCESSING_RESPONSE:j,SET_HAS_ERROR:g,SET_NO_ERROR:v,SET_QUANTITY:y,SET_REQUEST_PARAMS:R}=E,T=()=>({type:_}),C=(e=!0)=>({type:e?g:v}),{SET_PRISTINE:w,SET_IDLE:A,SET_DISABLED:P,SET_PROCESSING:I,SET_BEFORE_PROCESSING:N,SET_AFTER_PROCESSING:k,SET_PROCESSING_RESPONSE:D,SET_HAS_ERROR:L,SET_NO_ERROR:F,SET_QUANTITY:M,SET_REQUEST_PARAMS:x}=E,{PRISTINE:B,IDLE:q,DISABLED:Y,PROCESSING:G,BEFORE_PROCESSING:Q,AFTER_PROCESSING:V}=b,H=(e=p,{quantity:t,type:r,data:s})=>{let c;switch(r){case w:c=p;break;case A:c=e.status!==q?{...e,status:q}:e;break;case P:c=e.status!==Y?{...e,status:Y}:e;break;case M:c=t!==e.quantity?{...e,quantity:t}:e;break;case x:c={...e,requestParams:{...e.requestParams,...s}};break;case D:c={...e,processingResponse:s};break;case I:c=e.status!==G?{...e,status:G,hasError:!1}:e,c=!1===c.hasError?c:{...c,hasError:!1};break;case N:c=e.status!==Q?{...e,status:Q,hasError:!1}:e;break;case k:c=e.status!==V?{...e,status:V}:e;break;case L:c=e.hasError?e:{...e,hasError:!0},c=e.status===G||e.status===Q?{...c,status:q}:c;break;case F:c=e.hasError?{...e,hasError:!1}:e}return c!==e&&r!==w&&c.status===B&&(c.status=q),c};var K=r(70),W=r(154);const U="add_to_cart_before_processing",$="add_to_cart_after_processing_with_success",X="add_to_cart_after_processing_with_error",J=e=>({onAddToCartAfterProcessingWithSuccess:Object(W.a)($,e),onAddToCartProcessingWithError:Object(W.a)(X,e),onAddToCartBeforeProcessing:Object(W.a)(U,e)});var z=r(163),Z=r(37);const ee=Object(c.createContext)({product:{},productType:"simple",productIsPurchasable:!0,productHasOptions:!1,supportsFormElements:!0,showFormElements:!1,quantity:0,minQuantity:1,maxQuantity:99,requestParams:{},isIdle:!1,isDisabled:!1,isProcessing:!1,isBeforeProcessing:!1,isAfterProcessing:!1,hasError:!1,eventRegistration:{onAddToCartAfterProcessingWithSuccess:e=>{},onAddToCartAfterProcessingWithError:e=>{},onAddToCartBeforeProcessing:e=>{}},dispatchActions:{resetForm:()=>{},submitForm:()=>{},setQuantity:e=>{},setHasError:e=>{},setAfterProcessing:e=>{},setRequestParams:e=>{}}}),te=()=>Object(c.useContext)(ee),re=({children:e,product:t,showFormElements:r})=>{var s,n,o,E;const[_,g]=Object(c.useReducer)(H,p),[v,w]=Object(c.useReducer)(K.b,{}),A=Object(i.a)(v),{createErrorNotice:P}=Object(l.useDispatch)("core/notices"),{setValidationErrors:I}=Object(l.useDispatch)(d.VALIDATION_STORE_KEY),N=Object(c.useMemo)((()=>({onAddToCartAfterProcessingWithSuccess:J(w).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:J(w).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:J(w).onAddToCartBeforeProcessing})),[w]),k=Object(c.useMemo)((()=>({resetForm:()=>{g({type:m})},submitForm:()=>{g({type:f})},setQuantity:e=>{g((e=>({type:y,quantity:e}))(e))},setHasError:e=>{g(C(e))},setRequestParams:e=>{g((e=>({type:R,data:e}))(e))},setAfterProcessing:e=>{g({type:j,data:e}),g({type:S})}})),[]);Object(c.useEffect)((()=>{const e=_.status,r=!t.id||!u(t);e!==b.DISABLED||r?e!==b.DISABLED&&r&&g({type:O}):g(T())}),[_.status,t,g]),Object(c.useEffect)((()=>{_.status===b.BEFORE_PROCESSING&&(((e,t)=>{const r=Object(l.select)("core/notices").getNotices(t),{removeNotice:s}=Object(l.dispatch)("core/notices");r.filter((e=>"error"===e.status)).forEach((e=>s(e.id,t)))})(0,"wc/add-to-cart"),Object(z.a)(A,U,{}).then((e=>{!0!==e?(Array.isArray(e)&&e.forEach((({errorMessage:e,validationErrors:t})=>{e&&P(e,{context:"wc/add-to-cart"}),t&&I(t)})),g(T())):g({type:h})})))}),[_.status,I,P,g,A,null==t?void 0:t.id]),Object(c.useEffect)((()=>{if(_.status===b.AFTER_PROCESSING){const e={processingResponse:_.processingResponse},r=e=>{let t=!1;return e.forEach((e=>{const{message:r,messageContext:s}=e;(Object(Z.b)(e)||Object(Z.c)(e))&&r&&(t=!0,P(r,s?{context:s}:void 0))})),t};if(_.hasError)return void Object(z.b)(A,X,e).then((s=>{if(!r(s)){var c;const r=(null===(c=e.processingResponse)||void 0===c?void 0:c.message)||Object(a.__)("Something went wrong. Please contact us for assistance.","woocommerce");P(r,{id:"add-to-cart",context:`woocommerce/single-product/${(null==t?void 0:t.id)||0}`})}g(T())}));Object(z.b)(A,$,e).then((e=>{r(e)?g(C(!0)):g(T())}))}}),[_.status,_.hasError,_.processingResponse,k,P,A,null==t?void 0:t.id]);const D=(e=>["simple","variable"].includes(e.type||"simple"))(t),L={product:t,productType:t.type||"simple",productIsPurchasable:u(t),productHasOptions:t.has_options||!1,supportsFormElements:D,showFormElements:r&&D,quantity:_.quantity||(null==t||null===(s=t.add_to_cart)||void 0===s?void 0:s.minimum)||1,minQuantity:(null==t||null===(n=t.add_to_cart)||void 0===n?void 0:n.minimum)||1,maxQuantity:(null==t||null===(o=t.add_to_cart)||void 0===o?void 0:o.maximum)||99,multipleOf:(null==t||null===(E=t.add_to_cart)||void 0===E?void 0:E.multiple_of)||1,requestParams:_.requestParams,isIdle:_.status===b.IDLE,isDisabled:_.status===b.DISABLED,isProcessing:_.status===b.PROCESSING,isBeforeProcessing:_.status===b.BEFORE_PROCESSING,isAfterProcessing:_.status===b.AFTER_PROCESSING,hasError:_.hasError,eventRegistration:N,dispatchActions:k};return Object(c.createElement)(ee.Provider,{value:L},e)};var se=r(49),ce=r.n(se),ne=r(23),oe=r(105),ae=r(72),ie=()=>{const{dispatchActions:e,product:t,quantity:r,eventRegistration:s,hasError:n,isProcessing:o,requestParams:i}=te(),{showAllValidationErrors:u}=Object(l.useDispatch)(d.VALIDATION_STORE_KEY),b=Object(l.useSelect)((e=>e(d.VALIDATION_STORE_KEY).hasValidationErrors)),{createErrorNotice:p,removeNotice:E}=Object(l.useDispatch)("core/notices"),{receiveCart:m}=Object(ae.a)(),[_,O]=Object(c.useState)(!1),h=!n&&o,f=Object(c.useCallback)((()=>!b()||(u(),{type:"error"})),[b,u]);Object(c.useEffect)((()=>{const e=s.onAddToCartBeforeProcessing(f,0);return()=>{e()}}),[s,f]);const S=Object(c.useCallback)((()=>{O(!0),E("add-to-cart",`woocommerce/single-product/${(null==t?void 0:t.id)||0}`);const s={id:t.id||0,quantity:r,...i};ce()({path:"/wc/store/v1/cart/add-item",method:"POST",data:s,cache:"no-store",parse:!1}).then((r=>{ce.a.setNonce(r.headers),r.json().then((function(s){r.ok?m(s):(s.body&&s.body.message?p(Object(ne.decodeEntities)(s.body.message),{id:"add-to-cart",context:`woocommerce/single-product/${(null==t?void 0:t.id)||0}`}):p(Object(a.__)("Something went wrong. Please contact us for assistance.","woocommerce"),{id:"add-to-cart",context:`woocommerce/single-product/${(null==t?void 0:t.id)||0}`}),e.setHasError()),Object(oe.c)({preserveCartData:!0}),e.setAfterProcessing(s),O(!1)}))})).catch((t=>{t.json().then((function(t){var r;null!==(r=t.data)&&void 0!==r&&r.cart&&m(t.data.cart),e.setHasError(),e.setAfterProcessing(t),O(!1)}))}))}),[t,p,E,m,e,r,i]);return Object(c.useEffect)((()=>{h&&!_&&S()}),[h,S,_]),null};const ue=({children:e,product:t,showFormElements:r})=>Object(c.createElement)(re,{product:t,showFormElements:r},e,Object(c.createElement)(ie,null));var le=r(60);r(431);var de=r(112),be=r(76),pe=r(278),Ee=r(73),me=r(400);const _e=({className:e,href:t,text:r,onClick:s})=>Object(c.createElement)(de.a,{className:e,href:t,onClick:s,rel:"nofollow"},r),Oe=({className:e,quantityInCart:t,isProcessing:r,isDisabled:s,isDone:n,onClick:o})=>Object(c.createElement)(de.a,{className:e,disabled:s,showSpinner:r,onClick:o},n&&t>0?Object(a.sprintf)(/* translators: %s number of products in cart. */
Object(a._n)("%d in cart","%d in cart",t,"woocommerce"),t):Object(a.__)("Add to cart","woocommerce"),!!n&&Object(c.createElement)(be.a,{icon:pe.a}));var he=()=>{const{showFormElements:e,productIsPurchasable:t,productHasOptions:r,product:s,productType:n,isDisabled:o,isProcessing:i,eventRegistration:u,hasError:l,dispatchActions:d}=te(),{parentName:b}=Object(le.useInnerBlockLayoutContext)(),{dispatchStoreEvent:p}=Object(Ee.a)(),{cartQuantity:E}=Object(me.a)(s.id||0),[m,_]=Object(c.useState)(!1),O=s.add_to_cart||{url:"",text:""};return Object(c.useEffect)((()=>{const e=u.onAddToCartAfterProcessingWithSuccess((()=>(l||_(!0),!0)),0);return()=>{e()}}),[u,l]),(e||!r&&"simple"===n)&&t?Object(c.createElement)(Oe,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:E,isDisabled:o,isProcessing:i,isDone:m,onClick:()=>{d.submitForm(`woocommerce/single-product/${(null==s?void 0:s.id)||0}`),p("cart-add-item",{product:s,listName:b})}}):Object(c.createElement)(_e,{className:"wc-block-components-product-add-to-cart-button",href:O.url,text:O.text||Object(a.__)("View Product","woocommerce"),onClick:()=>{p("product-view-link",{product:s,listName:b})}})},fe=r(44),Se=({disabled:e,min:t,max:r,step:s=1,value:n,onChange:o})=>{const a=void 0!==r,i=Object(fe.b)((e=>{let c=e;a&&(c=Math.min(c,Math.floor(r/s)*s)),c=Math.max(c,Math.ceil(t/s)*s),c=Math.floor(c/s)*s,c!==e&&(null==o||o(c))}),300);return Object(c.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:n,min:t,max:r,step:s,hidden:1===r,disabled:e,onChange:e=>{null==o||o(e.target.value),i(Number(e.target.value))}})},je=({reason:e=Object(a.__)("Sorry, this product cannot be purchased.","woocommerce")})=>Object(c.createElement)("div",{className:"wc-block-components-product-add-to-cart-unavailable"},e),ge=()=>{const{product:e,quantity:t,minQuantity:r,maxQuantity:s,multipleOf:n,dispatchActions:o,isDisabled:i}=te();return e.id&&!e.is_purchasable?Object(c.createElement)(je,null):e.id&&!e.is_in_stock?Object(c.createElement)(je,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woocommerce")}):Object(c.createElement)(c.Fragment,null,Object(c.createElement)(Se,{value:t,min:r,max:s,step:n,disabled:i,onChange:o.setQuantity}),Object(c.createElement)(he,null))},ve=(r(432),r(498)),ye=r(12);const Re={value:"",label:Object(a.__)("Select an option","woocommerce")};var Te=({attributeName:e,options:t=[],value:r="",onChange:s=(()=>{}),errorMessage:n=Object(a.__)("Please select a value.","woocommerce")})=>{const i=e,{setValidationErrors:u,clearValidationError:b}=Object(l.useDispatch)(d.VALIDATION_STORE_KEY),{error:p}=Object(l.useSelect)((e=>({error:e(d.VALIDATION_STORE_KEY).getValidationError(i)||{}})));return Object(c.useEffect)((()=>{r?b(i):u({[i]:{message:n,hidden:!0}})}),[r,i,n,b,u]),Object(c.useEffect)((()=>()=>{b(i)}),[i,b]),Object(c.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(c.createElement)(ve.a,{label:Object(ne.decodeEntities)(e),value:r||"",options:[Re,...t],onChange:s,required:!0,className:o()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":(null==p?void 0:p.message)&&!(null!=p&&p.hidden)})}),Object(c.createElement)(ye.ValidationInputError,{propertyName:i,elementId:i}))},Ce=r(20);const we=(e,t,r)=>{const s=Object.values(t).map((({id:e})=>e));if(Object.values(r).every((e=>""===e)))return s;const c=Object.keys(e);return s.filter((e=>c.every((s=>{const c=r[s]||"",n=t["id:"+e].attributes[s];return""===c||null===n||n===c}))))};var Ae=({attributes:e,variationAttributes:t,setRequestParams:r})=>{const s=Object(i.a)(e),n=Object(i.a)(t),[o,a]=Object(c.useState)(0),[u,l]=Object(c.useState)({}),[d,b]=Object(c.useState)(!1),p=Object(c.useMemo)((()=>((e,t,r)=>{const s={},c=Object.keys(e),n=Object.values(r).filter(Boolean).length>0;return c.forEach((c=>{const o=e[c],a={...r,[c]:null},i=n?we(e,t,a):null,u=null!==i?i.map((e=>t["id:"+e].attributes[c])):null;s[c]=((e,t=null)=>Object.values(e).map((({name:e,slug:r})=>null===t||t.includes(null)||t.includes(r)?{value:r,label:Object(ne.decodeEntities)(e)}:null)).filter(Boolean))(o.terms,u)})),s})(s,n,u)),[u,s,n]);return Object(c.useEffect)((()=>{if(!d){const t=(e=>Object(Ce.a)(e)?0===Object.keys(e).length?{}:Object.values(e).reduce(((e,t)=>{const r=t.terms.filter((e=>e.default));var s;return r.length>0&&(e[t.name]=null===(s=r[0])||void 0===s?void 0:s.slug),e}),{}):{})(e);t&&l({...t}),b(!0)}}),[u,e,d]),Object(c.useEffect)((()=>{Object.values(u).filter((e=>""!==e)).length===Object.keys(s).length?a(((e,t,r)=>we(e,t,r)[0]||0)(s,n,u)):o>0&&a(0)}),[u,o,s,n]),Object(c.useEffect)((()=>{r({id:o,variation:Object.keys(u).map((e=>({attribute:e,value:u[e]})))})}),[r,o,u]),Object(c.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(s).map((e=>Object(c.createElement)(Te,{key:e,attributeName:e,options:p[e].filter(Boolean),value:u[e],onChange:t=>{l({...u,[e]:t})}}))))},Pe=({dispatchers:e,product:t})=>{const r=(e=>{return e?(t=Object.values(e).filter((({has_variations:e})=>e)),r="name",t.reduce(((e,t)=>(e[String(r?t[r]:t)]=t,e)),{})):{};var t,r})(t.attributes),s=(e=>{if(!e)return{};const t={};return e.forEach((({id:e,attributes:r})=>{t[`id:${e}`]={id:e,attributes:r.reduce(((e,{name:t,value:r})=>(e[t]=r,e)),{})}})),t})(t.variations);return 0===Object.keys(r).length||0===Object.keys(s).length?null:Object(c.createElement)(Ae,{attributes:r,variationAttributes:s,setRequestParams:e.setRequestParams})},Ie=()=>{const{product:e,quantity:t,minQuantity:r,maxQuantity:s,multipleOf:n,dispatchActions:o,isDisabled:i}=te();return e.id&&!e.is_purchasable?Object(c.createElement)(je,null):e.id&&!e.is_in_stock?Object(c.createElement)(je,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woocommerce")}):Object(c.createElement)(c.Fragment,null,Object(c.createElement)(Pe,{product:e,dispatchers:o}),Object(c.createElement)(Se,{value:t,min:r,max:s,step:n,disabled:i,onChange:o.setQuantity}),Object(c.createElement)(he,null))},Ne=()=>Object(c.createElement)(he,null),ke=()=>Object(c.createElement)("p",null,"This is a placeholder for the grouped products form element.");const De=()=>{const{showFormElements:e,productType:t}=te();return e?"variable"===t?Object(c.createElement)(Ie,null):"grouped"===t?Object(c.createElement)(ke,null):"external"===t?Object(c.createElement)(Ne,null):"simple"===t||"variation"===t?Object(c.createElement)(ge,null):null:Object(c.createElement)(he,null)};var Le=Object(s.withProductDataContext)((({className:e,showFormElements:t})=>{const{product:r}=Object(le.useProductDataContext)(),s=o()(e,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":(n=r,null==n||"object"==typeof n&&0===Object.keys(n).length||"string"==typeof n&&0===n.trim().length)});var n;return Object(c.createElement)(ue,{product:r,showFormElements:t},Object(c.createElement)("div",{className:s},Object(c.createElement)(De,null)))}));t.default=Object(s.withFilteredAttributes)({showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}})(Le)},58:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var s=r(0);r(5);const c=Object(s.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>({})}),n=()=>Object(s.useContext)(c)},70:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));let s=function(e){return e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback",e}({});const c={addEventCallback:(e,t,r=10)=>({id:Math.floor(Math.random()*Date.now()).toString(),type:s.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:r}),removeEventCallback:(e,t)=>({id:t,type:s.REMOVE_EVENT_CALLBACK,eventType:e})},n={},o=(e=n,{type:t,eventType:r,id:c,callback:o,priority:a})=>{const i=e.hasOwnProperty(r)?new Map(e[r]):new Map;switch(t){case s.ADD_EVENT_CALLBACK:return i.set(c,{priority:a,callback:o}),{...e,[r]:i};case s.REMOVE_EVENT_CALLBACK:return i.delete(c),{...e,[r]:i}}}},72:function(e,t,r){"use strict";r.d(t,"a",(function(){return j}));var s=r(56),c=r.n(s),n=r(0),o=r(3),a=r(5),i=r(23),u=r(150),l=r(58),d=r(121),b=r(105);const p=e=>{const t=null==e?void 0:e.detail;t&&t.preserveCartData||Object(a.dispatch)(o.CART_STORE_KEY).invalidateResolutionForStore()},E=e=>{(null!=e&&e.persisted||"back_forward"===Object(d.b)())&&Object(a.dispatch)(o.CART_STORE_KEY).invalidateResolutionForStore()},m=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},_={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},O={..._,email:""},h={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:o.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},f=e=>Object.fromEntries(Object.entries(e).map((([e,t])=>[e,Object(i.decodeEntities)(t)]))),S={cartCoupons:o.EMPTY_CART_COUPONS,cartItems:o.EMPTY_CART_ITEMS,cartFees:o.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,crossSellsProducts:o.EMPTY_CART_CROSS_SELLS,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:o.EMPTY_CART_ITEM_ERRORS,cartTotals:h,cartIsLoading:!0,cartErrors:o.EMPTY_CART_ERRORS,billingAddress:O,shippingAddress:_,shippingRates:o.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentMethods:o.EMPTY_PAYMENT_METHODS,paymentRequirements:o.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},receiveCartContents:()=>{},extensions:o.EMPTY_EXTENSIONS},j=(e={shouldSelect:!0})=>{const{isEditor:t,previewData:r}=Object(l.a)(),s=null==r?void 0:r.previewCart,{shouldSelect:i}=e,d=Object(n.useRef)();Object(n.useEffect)((()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),(null===(e=window.wcBlocksStoreCartListeners)||void 0===e?void 0:e.count)>0)return void window.wcBlocksStoreCartListeners.count++;var e;document.body.addEventListener("wc-blocks_added_to_cart",p),document.body.addEventListener("wc-blocks_removed_from_cart",p),window.addEventListener("pageshow",E);const t=Object(b.b)("added_to_cart","wc-blocks_added_to_cart"),r=Object(b.b)("removed_from_cart","wc-blocks_removed_from_cart");window.wcBlocksStoreCartListeners.count=1,window.wcBlocksStoreCartListeners.remove=()=>{document.body.removeEventListener("wc-blocks_added_to_cart",p),document.body.removeEventListener("wc-blocks_removed_from_cart",p),window.removeEventListener("pageshow",E),t(),r()}})(),m)),[]);const h=Object(a.useSelect)(((e,{dispatch:r})=>{if(!i)return S;if(t)return{cartCoupons:s.coupons,cartItems:s.items,crossSellsProducts:s.cross_sells,cartFees:s.fees,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:o.EMPTY_CART_ITEM_ERRORS,cartTotals:s.totals,cartIsLoading:!1,cartErrors:o.EMPTY_CART_ERRORS,billingData:O,billingAddress:O,shippingAddress:_,extensions:o.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{},receiveCartContents:"function"==typeof(null==s?void 0:s.receiveCartContents)?s.receiveCartContents:()=>{}};const c=e(o.CART_STORE_KEY),n=c.getCartData(),a=c.getCartErrors(),l=c.getCartTotals(),d=!c.hasFinishedResolution("getCartData"),b=c.isCustomerDataUpdating(),{receiveCart:p,receiveCartContents:E}=r(o.CART_STORE_KEY),m=f(n.billingAddress),h=n.needsShipping?f(n.shippingAddress):m,j=n.fees.length>0?n.fees.map((e=>f(e))):o.EMPTY_CART_FEES;return{cartCoupons:n.coupons.length>0?n.coupons.map((e=>({...e,label:e.code}))):o.EMPTY_CART_COUPONS,cartItems:n.items,crossSellsProducts:n.crossSells,cartFees:j,cartItemsCount:n.itemsCount,cartItemsWeight:n.itemsWeight,cartNeedsPayment:n.needsPayment,cartNeedsShipping:n.needsShipping,cartItemErrors:n.errors,cartTotals:l,cartIsLoading:d,cartErrors:a,billingData:Object(u.a)(m),billingAddress:Object(u.a)(m),shippingAddress:Object(u.a)(h),extensions:n.extensions,shippingRates:n.shippingRates,isLoadingRates:b,cartHasCalculatedShipping:n.hasCalculatedShipping,paymentRequirements:n.paymentRequirements,receiveCart:p,receiveCartContents:E}}),[i]);return d.current&&c()(d.current,h)||(d.current=h),d.current}},79:function(e,t,r){"use strict";var s=r(0);r(114),t.a=()=>Object(s.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},84:function(e,t,r){"use strict";var s=r(2),c=r(1),n=r(120),o=r(29),a=r(30);const i=e=>{const t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=Object(c.sprintf)(/* translators: %s Field label. */
Object(c.__)("%s (optional)","woocommerce"),e.label)),e.priority&&(Object(n.a)(e.priority)&&(t.index=e.priority),Object(o.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},u=Object.entries(a.e).map((([e,t])=>[e,Object.entries(t).map((([e,t])=>[e,i(t)])).reduce(((e,[t,r])=>(e[t]=r,e)),{})])).reduce(((e,[t,r])=>(e[t]=r,e)),{});t.a=(e,t,r="")=>{const c=r&&void 0!==u[r]?u[r]:{};return e.map((e=>({key:e,...s.defaultAddressFields[e]||{},...c[e]||{},...t[e]||{}}))).sort(((e,t)=>e.index-t.index))}}}]);